def to_lower(l):
    for ch in l:
        if ch == 'I':
            yield ch
        else:
            yield ch.lower()


def tokenize(s):
    buf = ''
    for ch in s:
        if ch == ' ':
            if len(buf) == 0:
                continue
            else:
                yield buf
                buf = ''
        elif ch in '!?,.\'\"':
            yield buf
            buf = ch
        else:
            buf += ch
    yield buf


def left_stripped(s):
    while len(s) > 0 and s[:1] in ' !?,.\'\"': s = s[1:]
    return s


def right_stripped(s):
    while len(s) > 0 and s[-1:] in ' !?,.\'\"': s = s[:-1]
    return s


def compose(l):
    result = [ '' ]
    compose_when = {
        'can': ['you'],
        'could': ['you'],
    }
    prev = None
    for token in l:
        if prev != None:
            if right_stripped(token) in compose_when[left_stripped(prev)]:  # can make a pair
                token = prev + ' ' + token
            else:  # can not make a pair
                yield prev
        if left_stripped(token) in compose_when.keys():
            prev = token
        else:
            yield token
            prev = None
    if prev != None:
        yield prev


def affirm(l):
    mapper = {
        'can you': 'I can',
        'could you': 'I could',
        'I': 'you',
        'me': 'you',
    }
    for token in l:
        token = token.replace('?', '!')
        for key in mapper.keys():
            idx = token.find(key)
            if idx != -1:
                left_part = token[:idx]
                right_part = token[(idx + len(key)):]
                if not left_part.isalpha() and not right_part.isalpha():
                    token = left_part + mapper[key] + right_part
                    break
        yield token


def fold(l):
    s = ''
    for token in l:
        if len(token) == 0: continue
        if token[0] in '!?,.\'\"':
            s += token
        else:
            s += ' ' + token
    return s.strip()


def answer(s):
    return fold(
      affirm(
        compose(
          list(tokenize(
            to_lower(s) # to lower
          ))            # tokenize
        )               # compose
      )                 # change to affirmative
    )                   # fold tokens into sentence

n = int(input())

for i in range(n):
    s = input()
    print(s)
    print('AI:', answer(s.strip()))
